/*
 * Copyright (c) 2018. czmc All Rights Reserved.
 * Author: czmc
 * Email: zxc6355533@163.com
 * Encoding: UTF-8
 */

package top.stime21.framework.utils

import android.content.Context


/**
 * Author: czmc  Email: zxc6355533@163.com
 * Version:	1.0  Date:2018/3/1
 */
object ResourceUtil {

    /** 根据名称寻找图片ID  */
    open fun getDrawableId(ctx: Context, identifier: String): Int {
        return ctx.getResources().getIdentifier(identifier, "drawable",
                ctx.getPackageName())
    }

    /** 根据名称寻找字符串ID  */
    open fun getStringId(ctx: Context, identifier: String): Int {
        return ctx.getResources().getIdentifier(identifier, "string",
                ctx.getPackageName())
    }

    /** 根据名称寻找数据ID  */
    open fun getRawId(ctx: Context, identifier: String): Int {
        return ctx.getResources().getIdentifier(identifier, "raw",
                ctx.getPackageName())
    }

    /** 根据名称寻找颜色ID  */
    open fun getColorId(ctx: Context, identifier: String): Int {
        return ctx.getResources().getIdentifier(identifier, "color",
                ctx.getPackageName())
    }

    /** 根据名称寻找动画ID  */
    open fun getAnimId(ctx: Context, identifier: String): Int {
        return ctx.getResources().getIdentifier(identifier, "anim",
                ctx.getPackageName())
    }

    /** 根据名称寻找布局ID  */
    open fun getLayoutId(ctx: Context, identifier: String): Int {
        return ctx.getResources().getIdentifier(identifier, "layout",
                ctx.getPackageName())
    }

    /** 根据名称寻找样式ID  */
    open fun getStyleId(ctx: Context, identifier: String): Int {
        return ctx.getResources().getIdentifier(identifier, "style",
                ctx.getPackageName())
    }

}